home *** CD-ROM | disk | FTP | other *** search
/ Internet Info 1994 March / Internet Info CD-ROM (Walnut Creek) (March 1994).iso / networking / ip / ppp / ppp-sunos4.1.pl6.mem_leak.patch < prev    next >
Text File  |  1992-01-09  |  2KB  |  89 lines

  1. *** ppp.c.old    Thu Jan  9 17:16:46 1992
  2. --- ppp.c    Thu Jan  9 17:16:40 1992
  3. ***************
  4. *** 839,845 ****
  5.   void io()
  6.   {
  7.       int len, i;
  8. !     u_char *p;
  9.       u_short protocol;
  10.   #ifdef    STREAMS
  11.       struct strbuf str;
  12. --- 839,845 ----
  13.   void io()
  14.   {
  15.       int len, i;
  16. !     u_char *p, *pstart;
  17.       u_short protocol;
  18.   #ifdef    STREAMS
  19.       struct strbuf str;
  20. ***************
  21. *** 850,855 ****
  22. --- 850,856 ----
  23.   
  24.       for (;;) {            /* Read all available packets */
  25.       p = (u_char *) malloc(MTU + DLLHEADERLEN);
  26. +     pstart = p;        /* save start of packet */
  27.   #ifdef    STREAMS
  28.       str.maxlen = MTU+DLLHEADERLEN;
  29.       str.buf = (caddr_t) p;
  30. ***************
  31. *** 859,864 ****
  32. --- 860,866 ----
  33.           if(errno == EAGAIN || errno == EWOULDBLOCK) {
  34.               if(debug > 2)
  35.                   perror("ppp: getmsg(fd)");
  36. +             free(pstart)
  37.               return;
  38.           }
  39.           perror("ppp: getmsg(fd)");
  40. ***************
  41. *** 871,876 ****
  42. --- 873,879 ----
  43.           if(debug > 2)
  44.               fprintf(stderr, "ppp: getmsg short return length %d\n",
  45.                   str.len);
  46. +         free(pstart);
  47.           return;
  48.       }
  49.           
  50. ***************
  51. *** 880,885 ****
  52. --- 883,889 ----
  53.           if (errno == EWOULDBLOCK) {
  54.           if (debug > 2)
  55.               perror("ppp: read(fd)");
  56. +         free(pstart);
  57.           return;
  58.           }
  59.           else {
  60. ***************
  61. *** 897,902 ****
  62. --- 901,907 ----
  63.       if (len < DLLHEADERLEN) {
  64.           if (debug)
  65.           fprintf(stderr, "ppp: input: Received short packet.\n");
  66. +         free(pstart);
  67.           return;
  68.       }
  69.   
  70. ***************
  71. *** 909,915 ****
  72.        */
  73.       if (protocol != LCP &&
  74.           lcp_fsm[0].state != OPEN) {
  75. !         free(p - DLLHEADERLEN);
  76.           return;
  77.       }
  78.   
  79. --- 914,922 ----
  80.        */
  81.       if (protocol != LCP &&
  82.           lcp_fsm[0].state != OPEN) {
  83. !         if (debug)
  84. !         fprintf(stderr, "ppp: input: Received non-LCP packet and LCP is not in open state.\n");
  85. !         free(pstart);
  86.           return;
  87.       }
  88.   
  89.